namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0143 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.SchedulerReports",
                c => new
                    {
                        SchRepId = c.Int(nullable: false, identity: true),
                        IntEmpStatusSeq = c.Int(),
                        ArgDbName = c.String(),
                        ArgServerName = c.String(),
                        ArgCmdId = c.String(),
                        DbConnectingOk = c.Boolean(nullable: false),
                        ErrorMessage = c.String(),
                        AmountCommandToExecute = c.Int(),
                        AmountCommandExecutePass = c.Int(),
                        CmdDtlIdExecuteError = c.Int(),
                        ErrorWhen = c.DateTime(),
                        StartWhen = c.DateTime(nullable: false),
                        StopWhen = c.DateTime(nullable: false),
                        ExecuteCompleted = c.Boolean(nullable: false),
                        IsStartManually = c.Boolean(nullable: false),
                    })
                .PrimaryKey(t => t.SchRepId);
            
            CreateTable(
                "dbo.SchedulerReportCmds",
                c => new
                    {
                        SchRepCmdId = c.Int(nullable: false, identity: true),
                        SchRepId = c.Int(),
                        CmdId = c.Int(),
                        CmdDtlId = c.Int(),
                    })
                .PrimaryKey(t => t.SchRepCmdId)
                .ForeignKey("dbo.hrm_ps_commands", t => t.CmdId)
                .ForeignKey("dbo.hrm_ps_command_dtls", t => t.CmdDtlId)
                .ForeignKey("dbo.SchedulerReports", t => t.SchRepId)
                .Index(t => t.CmdId)
                .Index(t => t.CmdDtlId)
                .Index(t => t.SchRepId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.SchedulerReportCmds", new[] { "SchRepId" });
            DropIndex("dbo.SchedulerReportCmds", new[] { "CmdDtlId" });
            DropIndex("dbo.SchedulerReportCmds", new[] { "CmdId" });
            DropForeignKey("dbo.SchedulerReportCmds", "SchRepId", "dbo.SchedulerReports");
            DropForeignKey("dbo.SchedulerReportCmds", "CmdDtlId", "dbo.hrm_ps_command_dtls");
            DropForeignKey("dbo.SchedulerReportCmds", "CmdId", "dbo.hrm_ps_commands");
            DropTable("dbo.SchedulerReportCmds");
            DropTable("dbo.SchedulerReports");
        }
    }
}
